package com.edu.zju.scs.panacea.common;

import com.edu.zju.scs.panacea.entity.exposure.DevPortrayalData;
import com.edu.zju.scs.panacea.entity.exposure.Exposure;
import com.edu.zju.scs.panacea.entity.resource.Template;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by liangyue on 2017/9/26.
 */
public class Global implements Serializable{

    public static final class Code {
        /**
         * @Fields ok : 成功
         *
         */
        public static final int success = 0;
        /**
         * @Fields error : 失败
         */
        public static final int error = 1;
    }

    public static final class Message {
        /**
         * @Fields ok : 成功
         */
        public static final String success = "成功!";
        /**
         * @Fields error : 失败
         */
        public static final String error = "系统错误!";
        @SuppressWarnings("unused")
        public static final String object_not_find = "找不到要操作的记录!";
    }
    public enum ErrorEncode {
        ;
        private String name;
        private int errorNo;

        // 构造方法
        ErrorEncode(String name, int errorNo) {
            this.name = name;
            this.errorNo = errorNo;
        }


        public static String getName(int index) {
            for (ErrorEncode e : ErrorEncode.values()) {
                if (e.getErrorNo()==index) {
                    return e.name;
                }
            }
            return null;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getErrorNo() {
            return errorNo;
        }

        public void setErrorNo(int errorNo) {
            this.errorNo = errorNo;
        }
    }


    public static int ALL_DEV = 0;
    public static int RES_DEV = 1;
    public static int NOT_RES_DEV = 2;

    public static int PROVINCE = 0;
    public static int CITY = 1;
    public static int DISTRICT = 2;

    public static HashMap<Long, Exposure> exposureHashMap = new HashMap<>();
    public static HashMap<Long, DevPortrayalData> devPortrayalDataHashMap = new HashMap<>();

}
